/*  ----------------------------------------------------------------------------
 *  Arello Mobile
 *  Fast 3d Engine
 *  ----------------------------------------------------------------------------
 * Except where otherwise noted, this work is licensed under
 * http://creativecommons.org/licenses/by/3.0
 */

#ifndef __LIB3D_HARD_TEXTUREBASE_H__
#define __LIB3D_HARD_TEXTUREBASE_H__

#include <pictureformat/PictureFormat.h>

#define POW2_TEXTURE

namespace liba
{
namespace lib3d
{
namespace hard
{

class TextureBase
{
protected:
	int mipmap_levels;
	const pictureformat::Format hardware_format;
	const int width;
	const int height;
#if defined(IPHONE_VERSION) || defined(POW2_TEXTURE)
	const float u_scale;
	const float v_scale;
	const float original_width;
	const float original_height;
#endif
public:
	TextureBase(int mipmap_levels, const pictureformat::Format & hardware_format, int width, int height);
	virtual ~TextureBase();
	int get_mipmap_levels()const
	{
		return mipmap_levels;
	}
	const pictureformat::Format & get_hardware_format()const
	{
		return hardware_format;
	}
	int get_width()
	{
#if defined(IPHONE_VERSION) || defined(POW2_TEXTURE)
		return (int) original_width;
#else
		return width;
#endif
	}
	int get_height()
	{
#if defined(IPHONE_VERSION) || defined(POW2_TEXTURE)
		return (int) original_height;
#else
		return height;
#endif
	}
	virtual bool is_valid()=0;
	virtual bool set_in_hardware(int stage)=0;
	
	static void report_usage();
};


} // namespace hard
} // namespace lib3d
} // namespace liba
using namespace liba;

#endif //__LIB3D_HARD_TEXTUREBASE_H__